]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell/app: Cleanup journalfd with g_autofd instead of close()
authorSwagtoy <me@ow.swag.toys>
Mon, 1 Jun 2026 19:24:01 +0000 (15:24 -0400)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 29 Jun 2026 17:46:09 +0000 (19:46 +0200)
Signed-off-by: Swagtoy <me@ow.swag.toys>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4233>
(cherry picked from commit e57c64620ea7d1b6f208a3ba53b0fcaebf764876)

src/shell-app.c

index acb996c0ba58094eef26f06478e0a121e63e2c41..d47c49c200e71688618f00af94db904ebcde3408 100644 (file)
@@ -5,6 +5,7 @@
 #include <string.h>
 
 #include <glib/gi18n-lib.h>
+#include <glib/gstdio.h>
 
 #include <meta/display.h>
 #include <meta/meta-context.h>
@@ -1399,7 +1400,7 @@ shell_app_launch (ShellApp           *app,
 
   /* Optimized spawn path, avoiding a child_setup function */
   {
-    int journalfd = -1;
+    g_autofd int journalfd = -1;
 
 #ifdef HAVE_SYSTEMD
     journalfd = sd_journal_stream_fd (shell_app_get_id (app), LOG_INFO, FALSE);
@@ -1414,9 +1415,6 @@ shell_app_launch (ShellApp           *app,
                                                               journalfd,
                                                               journalfd,
                                                               error);
-
-    if (journalfd >= 0)
-      (void) close (journalfd);
   }
   g_object_unref (context);